package com.zonski.jbots.desktop.engine;

import java.awt.Component;

import com.zonski.jbots.engine.AbstractEngineRunner;
import com.zonski.jbots.engine.Engine;

import com.zonski.jbots.desktop.client.DesktopDevice;
import com.zonski.jbots.game.JBotsGameController;

public class EngineRunner extends AbstractEngineRunner
{
    private Component canvas;
    private DesktopDevice device;
    private JBotsGameController controller;

    public EngineRunner(JBotsGameController controller, DesktopDevice device)
    {
        super(controller.getEngine());
        this.controller = controller;
        this.device = device;
    }

    public void setCanvas(Component canvas)
    {
        this.canvas = canvas;
    }

    protected void onUpdate()
    {
        this.controller.update();
        this.device.update();
        this.canvas.repaint();
    }
}
